<?php
session_name("sesiondirh");
session_start();
include("db_conn.php");

$rut = $_POST['rut'];
$var = $_POST['texto'];
$db_conn = conecta();
echo $var."<br />";
$unsvar = unserialize($var);
//$array = array('id' => '','chk' => '');
foreach($unsvar as $key):
	$all = explode(",",$key);
	if($all[1] == 1){
		$array['id']= $all[0];
		$array['chk'] = $all[1]; 
		//echo $array['id']." ".$array['chk']."<br />";
		$update = "update Partida set recibida = '$all[1]' where Id = '$all[0]' and RutCliente = '$rut'";
		mysql_query($update,$db_conn);
		$error = mysql_error($db_conn);
		if(!empty($error)){
			//header('location:info.php?rut='.$Rut.'');
			echo 'A ocurrido un error al modifcar el valor de la partida, intentelo nuevamente <br>';
			echo $error;
		}
		else
			header('location:info.php?rut='.$rut.'#tab-info');
	}
	//echo $key."<br />";
endforeach;
?>